General usage

[1] For scRNA-seq data, we suggest to revise the gene symbols with rev_gene(). geneinfo is the system data.frame containing the information of human and mouse from NCBI gene(updated in June. 19, 2022). To use your own geneinfo data.frame, please refer to demo_geneinfo() to build a new one, e.g., rat, zebrafish, Drosophila, C. elegans, etc.

library(scCrossTalk)
load(paste0(system.file(package = "scCrossTalk"), "/extdata/example.rda"))

# demo_geneinfo
demo_geneinfo()
#>   symbol synonyms species
#> 1   A1BG      A1B   Human
#> 2   A1BG      ABG   Human
#> 3  A2MP1     A2MP   Human
#> 4   Aco1      Aco   Mouse

# demo_sc_data
demo_sc_data()
#> 6 x 6 sparse Matrix of class "dgCMatrix"
#>      cell1 cell2 cell3 cell4 cell5 cell6
#> A1BG     .    17     .     .     .     .
#> A2M      .     .     .    36     .    33
#> A2MP     .     .     .     6    45     .
#> NAT1     1    21     .    32    11    11
#> NAT2     .     .     .    44     .    22
#> NATP    20    29     .     .    10     6

# revise gene symbols
sc_data <- rev_gene(data = sc_data,data_type = "count",species = "Human",geneinfo = geneinfo)

[2] create scCrossTalk object with create_scCrossTalk(). Users need to provide the raw count data and the cell type. scCrossTalk will use NormalizeData() in Seurat to normalize data by default. If your data has been normalized by other methods, you can set the parameter if_normalize = FALSE

obj <- create_scCrossTalk(sc_data = sc_data, sc_celltype = sc_celltype, species = "Human", if_normalize = TRUE)
#> Warning: Feature names cannot have underscores ('_'), replacing with dashes
#> ('-')

# If your data has been normalized by other methods, you can set the parameter `if_normalize = FALSE`

# obj <- create_scCrossTalk(sc_data = sc_data, sc_celltype = sc_celltype,species = "Human", if_normalize = FALSE)

[3] find highly expressed LR pairs with find_lrpairs(). Users need to provided the speices and lr pairs database. lrpairs is the system data.frame containing the known LR pairs of human and mouse from CellTalkDB. To use your own lrpairs data.frame, please refer to demo_lrpairs() to build a new one, e.g., rat, zebrafish, Drosophila, C. elegans, etc.

# demo_lrpairs
demo_lrpairs()
#>   ligand receptor species
#> 1 CX3CL1   CX3CR1   Human
#> 2  TGFB1   TGFBR2   Human
#> 3   CCL2     CCR2   Human
#> 4    Sst    Sstr1   Mouse

# find highly expressed LR pairs
obj <- find_lrpairs(object = obj, lrpairs = lrpairs, min_cell_num = 10, cell_min_pct = 0.1, p_value = 0.05)
#> Finding highly expressed LR pairs

# results is stored in obj@cci
cci <- obj@cci
head(cci)
#>   celltype_sender celltype_receiver ligand receptor ligand_pct ligand_exp_avg
#> 1     acinar_cell       acinar_cell    VIM     CD44  0.6155718      0.8339240
#> 2     acinar_cell       acinar_cell     C3     CD46  0.5255474      0.8740566
#> 3     acinar_cell       acinar_cell CXCL12    ITGB1  0.6496350      0.6158164
#> 4     acinar_cell       acinar_cell  LMAN1    MCFD2  0.8199513      0.7800645
#> 5     acinar_cell       acinar_cell CXCL12     SDC4  0.6496350      0.6158164
#> 6     acinar_cell        alpha_cell     C3     CD46  0.5255474      0.8740566
#>   ligand_z_score ligand_p_value receptor_pct receptor_exp_avg receptor_z_score
#> 1       2.611653    0.004505282    0.9075426        2.2410825         7.678032
#> 2       2.756148    0.002924328    0.8077859        0.8377001         2.625249
#> 3       1.826372    0.033897157    0.7883212        0.6926912         2.103154
#> 4       2.417736    0.007808710    0.8223844        0.9291400         2.954472
#> 5       1.826372    0.033897157    0.7737226        0.7283321         2.231477
#> 6       2.756148    0.002924328    0.9227683        1.6624160         5.250688
#>       score
#> 1 1.8688924
#> 2 0.7321973
#> 3 0.4265706
#> 4 0.7247891
#> 5 0.4485189
#> 6 1.4530456

[4] Visualize the cell-cell communications with plot_cci_chord(), parameters see below:

plot_cci_chord(object = obj)

[5] Visualize the cell-cell communications with plot_cci_circle(), parameters see below:

plot_cci_circle(object = obj)

Note

To show one or more senders or receivers by retaining all cell types, users can use plot_cci_circle_simple() for plotting.

[6] Visualize the cell-cell communications with plot_cci_circle_simple(), parameters see below:

# as sender
plot_cci_circle_simple(object = obj, celltype = "ductal_cell", celltype_dir = "sender")


# as receiver
plot_cci_circle_simple(object = obj, celltype = "ductal_cell", celltype_dir = "reciver")

[7] Visualize the cell-cell communications with plot_cci_heatmap(), parameters see below:

plot_cci_heatmap(object = obj)

[8] Visualize the cell-cell communications with plot_cci_sankey(), parameters see below:

plot_cci_sankey(object = obj)

[9] Visualize the LR interactions with plot_cci_lrpairs_heatmap(), parameters see below:

plot_cci_lrpairs_heatmap(object = obj)

[10] Visualize the LR interactions with plot_cci_lrpairs_bubble(), parameters see below:

plot_cci_lrpairs_bubble(object = obj)

Note

To filter the top LR interactions, users can use get_top_lrpairs() for plotting

obj_filter <- obj
obj_filter@cci <- get_top_lrpairs(object = obj_filter, top_n = 5)
plot_cci_lrpairs_bubble(object = obj_filter, size = 2, if_horizontal = FALSE)

plot_cci_lrpairs_heatmap(object = obj_filter, celltype = c("alpha_cell","beta_cell", "delta_cell", "ductal_cell"))

[11] Visualize the LR interactions with plot_lrpairs_chord(), parameters see below:

plot_lrpairs_chord(obj,celltype_sender = "alpha_cell",celltype_receiver = "beta_cell",link.arr.width = 0.5, link.arr.length = 0.2, text_size = 0.8)

[12] Visualize the LR interactions with plot_lrpairs_heatmap(), parameters see below:

plot_lrpairs_heatmap(obj,celltype_sender = "alpha_cell",celltype_receiver = "beta_cell")

About

Please refer to the scCrossTalk on GitHub or the document or tutorial-jupyter for more information.